package chapter03

object Demo01_TestOperator {
  def main(args: Array[String]): Unit = {
    //算术运算符
    val result1: Int = 10 / 3
    println(result1) //3

    val result2: Double = 10 / 3
    println(result2) //3.0

    val result3: Double = 10.0 / 3
    println(result3) //3.3333333333333335
    println(result3.formatted(("%5.2f")))  //3.33

    //取余
    val result: Int = 10 % 3
    println(result)

    //比较运算符
    val s1: String = "hello"
    val s2: String = new String("hello")
    println(s1 == s2)  //true
    println(s1.equals(s2))  //true
    println(s1.eq(s2))  //false  用eq比较可以比较地址值

    //赋值运算符
    var b: Int = 19
    b += 1
    println(b)

  }
}
